#include <stddef.h>
#ifndef DUMPER_H_69F31125D59E06AB4FD48910D402365D
#define DUMPER_H_69F31125D59E06AB4FD48910D402365D   1

#include "DumperNLS.h"

enum DpEx {
    DpEx_OutOfFileSize,
    DpEx_OutOfFilePartRange,
    DpEx_CannotAllocMemory,
    DpEx_UnknownElfFormat,
};

char* dp_u16stou8(const unsigned short* pwStr);
char* dp_u32stou8(const unsigned * pdStr);

void dump_exe_file(FILE *fp, const char* filename);
void dump_msobj_file(FILE *fp, const char* filename);
void dump_elf_file(FILE *fp, const char* filename);
void dump_macho_file(FILE *fp, const char* filename);
void dump_res_file(FILE *fp, const char* filename);
void dump_unknow_file(FILE *fp, const char* filename);

void _dump_elf_filepart(FILE* fp, int embed);

// swap endian funtion
unsigned short dpSwap16(unsigned short value);
unsigned dpSwap32(unsigned value);
unsigned long long dpSwap64(unsigned long long value);
unsigned short dpAutoSwap16(unsigned short value);
unsigned dpAutoSwap32(unsigned value);
unsigned long long dpAutoSwap64(unsigned long long value);
const char* dpll2hex(unsigned long long iv);
const char* dpll2Hex(unsigned long long iv);

// file I/O
long long dpGetFileSize(FILE * fp);
size_t dp_fread(void *buffer, size_t size, size_t count, FILE *stream);
int dp_fseek64(FILE *stream, long long offset, int origin);
int dp_fseek64_in_filepart(FILE *stream, long long offset, int origin);
void dpSetDumppingFileSize(long long filesize);
void dpSetDumppingFileName(const char* filename);
const char* dpGetDumppingFileName(void);
void dpSetDumppingFilePart(long long start, long long size);
void dpSetFileFormatLittleEndian(bool isLittleEndian);


#endif //DUMPER_H_69F31125D59E06AB4FD48910D402365D

